		$(document).ready(function(){
				$('ul.tabs').each(function(){
					var $active, $content, $links = $(this).find('a');
					$active = $($links.filter('[href="'+location.hash+'"]')[0] || $links[0]);
					$active.addClass('active');

					$content = $($active[0].hash);

					$links.not($active).each(function () {
						$(this.hash).hide();
					});

					$(this).on('click', 'a', function(e){
						$active.removeClass('active');
						$content.hide();
						$active = $(this);
						$content = $(this.hash);
						$active.addClass('active');
						$content.show();
						e.preventDefault();
					});
				  	$.fn.raty.defaults.path = 'vote/lib/images';
				    $('#default').raty();
				});
	$('a[name=modal]').click(function(e) {
		e.preventDefault();
		var id = $(this).attr('href');
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.8);	
		var winH = $(window).height();
		var winW = $(window).width();
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
		$(id).fadeIn(2000); 
	
	});
	
	$('.window .close').click(function (e) {
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});		
	
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});			

	$(window).resize(function () {
 		var box = $('#boxes .window');
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();
        $('#mask').css({'width':maskWidth,'height':maskHeight});   
        var winH = $(window).height();
        var winW = $(window).width();
        box.css('top',  winH/2 - box.height()/2);
        box.css('left', winW/2 - box.width()/2);
		 
		});
		
		$('a').tipsy({
			gravity: $.fn.tipsy.autoNS,
			fade: 'true',
			delayIn: 0,      // delay before showing tooltip (ms)
		    delayOut: 0,     // delay before hiding tooltip (ms)
		    fallback: '',    // fallback text to use when no tooltip text
		    html: false,     // is tooltip content HTML?
		    live: false,     // use live event support?
		    offset: 5,       // pixel offset of tooltip from element
		    opacity: 0.9,    // opacity of tooltip
		    title: 'title',  // attribute/callback containing tooltip text
		    trigger: 'hover' // how tooltip is triggered - hover | focus | manual
		})
		$(".switch-comments").click(function(){
			$("#discussion").slideToggle('600');
		});
		$(".download-list li .quality").css("display","none");
			$(".download-list li > a").click(function(){
				$(this).next().slideToggle(500,function(){
					return false;
			});
		});
	});
	$(window).load(function(){
      $('.flexslider').flexslider({
        animation: "slide",
        animationLoop: false,
        itemWidth: 190,
      });
    });
	$(function(){
				$(window).scroll(function(){
					if ($(this).scrollTop() > 120){
						$(".top").fadeIn();
					}else{
						$(".top").fadeOut();
					}
				});

				$(function(){
					$(".top").click(function(){
						$("html,body").animate({scrollTop:0},800);
						return false;
					});
				});

			});